import { routes } from '@/routes/list';
import { findElementByPath, findNameByPath } from '@/utils/common';
const home_path = import.meta.env.VITE_HOME_PATH;

const useHome = () => {
    const list = home_path.split("/").filter((el: any) => el);
    const home_name = findNameByPath(routes[0].children, list[1]);
    const Home = findElementByPath(routes[0].children, list[0]);
    // 初始化tags
    const initialItems = [
        { label: home_name, children: <Home />, key: home_path, closable: false },
    ];
    return { initialItems, list };
}

export default useHome;